﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Rapid
{
    public partial class TestCommonTemplate : UserControl
    {
        public TestCommon test;

        public TestCommonTemplate()
        {
            InitializeComponent();
        }

        public void Init(TestCommon test)
        {
            this.test = test;
            this.SetBackground();
        }

        public void SetBackground()
        {
            if (this.test.observation == EObservationCommon.Normal)
            {
                switch(this.test.testType)
                {
                    case ETestCommon.Cr:
                        SetBackground(Properties.Resources.Normal_Cr);
                        break;
                    case ETestCommon.Ni:
                        SetBackground(Properties.Resources.Normal_Ni);
                        break;
                    case ETestCommon.pH:
                        SetBackground(Properties.Resources.Normal_pH);
                        break;
                    case ETestCommon.Bl:
                        SetBackground(Properties.Resources.Normal_Bl);
                        break;
                    default://case ETestCommon.SG:
                        SetBackground(Properties.Resources.Normal_SG);
                        break;
                }
            }
            else
            {
                switch (this.test.testType)
                {
                    case ETestCommon.Cr:
                        SetBackground(Properties.Resources.Abnormal_Cr);
                        break;
                    case ETestCommon.Ni:
                        SetBackground(Properties.Resources.Abnormal_Ni);
                        break;
                    case ETestCommon.pH:
                        SetBackground(Properties.Resources.Abnormal_pH);
                        break;
                    case ETestCommon.Bl:
                        SetBackground(Properties.Resources.Abnormal_Bl);
                        break;
                    default://case ETestCommon.SG:
                        SetBackground(Properties.Resources.Abnormal_SG);
                        break;
                }
            }
        }

        private void SetBackground(Bitmap resourceImage)
        {
            this.BackgroundImage = (System.Drawing.Image)resourceImage;
        }
    }
}
